﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFP;
using SFP.CollisionDetection;
using HamsterDelivery.LevelStructure;
using HamsterDelivery.LevelStructure.GameObjects;

namespace HamsterDelivery.LevelStructure.Reactions
{
    public class GrasReaction : Reaction
    {
        HamsterGame game;
        
        public GrasReaction(HamsterGame game)
        {
            this.game = game;
        }

        private void observeGras(CollisionInfo collisionInfo)
        {
            GrasObject grasObject = (GrasObject)collisionInfo.GameObject;
            if (grasObject.Observe())
            {
                LetterObject letter = new LetterObject(game);
                letter.X = grasObject.X;
                letter.Y = grasObject.Y;
                letter.Image = Resources.B_LETTER;
                letter.startJump();
                game.Level.addGameObject(letter, Level.MAIN_LAYER, game.Level.Letters);
            }
        }

        protected override void fromBeneath(CollisionInfo collisionInfo)
        {
        }

        protected override void fromAbove(CollisionInfo collisionInfo)
        {
            observeGras(collisionInfo);
        }

        protected override void fromLeft(CollisionInfo collisionInfo)
        {
            observeGras(collisionInfo);
        }

        protected override void fromRight(CollisionInfo collisionInfo)
        {
            observeGras(collisionInfo);
        }

        protected override void touchesTop(CollisionInfo collisionInfo)
        {
        }

        protected override void touchesBottom(CollisionInfo collisionInfo)
        {
        }

        protected override void touchesLeft(CollisionInfo collisionInfo)
        {
        }

        protected override void touchesRight(CollisionInfo collisionInfo)
        {
        }
    }
}
